#include <iostream>
using namespace std;
class Cpoint
{public:
    Cpoint(float c=0,float d=0)
    {
        this->x=c;
        this->y=d;
    }
    float GetX(){return x;}
    float GetY(){return y;}
    void SetX(float m){ this->x=m;}
    void SetY(float n){ this->y=n;}

private:
    float x,y;
};
class CRectangle
{
public:
    CRectangle(const Cpoint &a,const Cpoint &b)
    {
        lbPoint =a;
        raPoint =b;
    }
    void SetLPoint(const Cpoint &l)//
    {
        lbPoint = l;
    }
    void SetRPoint(const Cpoint &r)//
    {
        raPoint =r;
    }
    float GetPerimeter()
    {
        return (raPoint.GetX()-lbPoint.GetX()+raPoint.GetY()-lbPoint.GetY())*2;
    }
    float GetArea()
    {
        return (raPoint.GetX()-lbPoint.GetX())*(raPoint.GetY()-lbPoint.GetY());
    }
private:
    Cpoint lbPoint,raPoint;
};
int main()
{
    Cpoint p1(2,5),p2(6,8);
    CRectangle *a_rectagnle = new CRectangle(p1,p2);
    cout<<"矩形的周长： "<<a_rectagnle-> GetPerimeter() <<endl;
    cout<<"矩形的面积： "<<a_rectagnle-> GetArea()<<endl;
    p1.SetX(4);
    p1.SetY(6);
    p2.SetX(7);
    p2.SetY(9);
    a_rectagnle->SetLPoint(p1);
    a_rectagnle->SetRPoint(p2);
    cout<<"改变的矩形周长："<<a_rectagnle->GetPerimeter()<<endl;
    cout<<"改变的矩形面积："<<a_rectagnle->GetArea()<<endl;
    delete  a_rectagnle;
    return 0;
}
